package HomeWork;

/*
 *@auther will
 *@version 1.0
 */public class Homework04 {
    public static void main(String[] args) {
        Cellphone cellphone = new Cellphone();
        cellphone.testWork(new Caculator() {
            @Override
            public double work(double n1, double n2) {
                return n1+n2;
            }
        },10,8);
    }
}

interface Caculator{

     public double work(double n1,double n2);
}

class Cellphone{
    public void testWork(Caculator caculator,double n1,double n2){
        double result = caculator.work(n1,n2);
        System.out.println("运算的结果是："+result);
    }
}